package com.franklin.ideaplugin.maphelper.col.operation.impl.collection.deque;

import com.franklin.ideaplugin.maphelper.col.method.IColInsertMethod;
import com.franklin.ideaplugin.maphelper.col.method.IColQueryMethod;
import com.franklin.ideaplugin.maphelper.col.method.impl.ColInsertMethodImpl;
import com.franklin.ideaplugin.maphelper.col.method.impl.DefaultColQueryMethod;
import com.franklin.ideaplugin.maphelper.col.operation.impl.collection.queue.QueueReadWriteOperation;

import java.util.Deque;
import java.util.Set;

/**
 * 双向队列操作
 *
 * @author Ye Junhui
 * @since 2024/3/11
 */
public class DequeReadWriteOperation extends QueueReadWriteOperation {

    @Override
    public String getClassQualifiedName() {
        return Deque.class.getName();
    }

    @Override
    public Set<IColInsertMethod> getInsertMethods() {
        Set<IColInsertMethod> insertMethods = super.getInsertMethods();
        insertMethods.add(new ColInsertMethodImpl("addFirst", 1, 0));
        insertMethods.add(new ColInsertMethodImpl("addLast", 1, 0));
        insertMethods.add(new ColInsertMethodImpl("offerFirst", 1, 0));
        insertMethods.add(new ColInsertMethodImpl("offerLast", 1, 0));
        insertMethods.add(new ColInsertMethodImpl("add", 1, 0));
        insertMethods.add(new ColInsertMethodImpl("offer", 1, 0));
        insertMethods.add(new ColInsertMethodImpl("push", 1, 0));
        return insertMethods;
    }

    @Override
    public Set<IColQueryMethod> getQueryMethods() {
        Set<IColQueryMethod> queryMethods = super.getQueryMethods();
        queryMethods.add(new DefaultColQueryMethod("removeFirst", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("removeLast", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("pollFirst", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("pollLast", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("getFirst", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("getLast", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("peekFirst", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("peekLast", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("remove", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("poll", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("element", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("peek", 0, -1));
        queryMethods.add(new DefaultColQueryMethod("pop", 0, -1));
        return queryMethods;
    }

    @Override
    public Set<IColInsertMethod> getInsertAllMethods() {
        Set<IColInsertMethod> insertAllMethods = super.getInsertAllMethods();
        insertAllMethods.add(new ColInsertMethodImpl("addAll",1,0));
        return insertAllMethods;
    }
}
